Skip to content

[PWGLF] dndeta-hi: move from PWGMM, add SD/DD/ND classification#15779

Draft
hyungjun-lee wants to merge 9 commits intoAliceO2Group:masterfrom
hyungjun-lee:dndeta-hi-pwglf
Draft

[PWGLF] dndeta-hi: move from PWGMM, add SD/DD/ND classification#15779
hyungjun-lee wants to merge 9 commits intoAliceO2Group:masterfrom
hyungjun-lee:dndeta-hi-pwglf

Conversation

@hyungjun-lee
Copy link
Copy Markdown
Contributor

  • Move dndeta-hi.cxx from PWGMM/Mult/Tasks to PWGLF/Tasks/GlobalEventProperties
  • Add kDD, kSD, kND enum values for diffractive event classification
  • Join McCollisions with HepMCXSections to access processId() in processMCCounting
  • Classify events by Pythia8 process code: 101=ND, 103/104=SD, 105/106=DD
  • Replace sliceByCached with sliceBy+Preslice for soa::Filtered tables
  • Fix std-prefix: std::log, std::exp, std::fabs
  • Fix const-ref-in-for-loop: const auto& in range-based for loops
  • Fix pdg/explicit-code: 310->kK0Short, 3122->kLambda0
  • Add CMakeLists.txt entry for dndeta-hi workflow

- Move dndeta-hi.cxx from PWGMM/Mult/Tasks to PWGLF/Tasks/GlobalEventProperties
- Add kDD, kSD, kND enum values for diffractive event classification
- Join McCollisions with HepMCXSections to access processId() in processMCCounting
- Classify events by Pythia8 process code: 101=ND, 103/104=SD, 105/106=DD
- Replace sliceByCached with sliceBy+Preslice for soa::Filtered tables
- Fix std-prefix: std::log, std::exp, std::fabs
- Fix const-ref-in-for-loop: const auto& in range-based for loops
- Fix pdg/explicit-code: 310->kK0Short, 3122->kLambda0
- Add CMakeLists.txt entry for dndeta-hi workflow
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 15, 2026

O2 linter results: ❌ 1 errors, ⚠️ 4 warnings, 🔕 0 disabled

@alibuild
Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/o2 for f7ae6fe at 2026-04-15 10:25:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndeta-hi.cxx:12:10: fatal error: Index.h: No such file or directory
ninja: build stopped: subcommand failed.

Full log here.

@alibuild
Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/o2 for 400b75d at 2026-04-15 10:56:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:16:10: fatal error: Index.h: No such file or directory
ninja: build stopped: subcommand failed.

Full log here.

@abmodak
Copy link
Copy Markdown
Collaborator

abmodak commented Apr 15, 2026

Hi @hyungjun-lee, can you please take care of o2-building error (https://ali-ci.cern.ch/alice-build-logs/AliceO2Group/O2Physics/15779/400b75d0b31bdf93b26a9e7717525813cfec57df/build_O2Physics_o2/pretty.html) by removing the line #include "Index.h"

Thanks,
Abhi

@hyungjun-lee
Copy link
Copy Markdown
Contributor Author

The remaining o2linter error originates from code outside of my responsibility. Could you please approve this commit?

@abmodak
Copy link
Copy Markdown
Collaborator

abmodak commented Apr 15, 2026

Hello @hyungjun-lee, I talked about the O2-building errors (not the linter error). But anyway, you fixed it, thanks!
I will approve the PR once all the required checks will be finished.

Thanks,
Abhi

@vkucera vkucera marked this pull request as draft April 15, 2026 09:39
@alibuild
Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/o2 for 2d7e2be at 2026-04-15 11:40:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:69:52: error: 'ParticlesToTracks' is not a member of 'o2::aod'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:69:69: error: template argument 2 is invalid
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:69:24: error: '<expression error>' in namespace 'o2::soa' does not name a type
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:196:54: error: 'pi' is not a member of 'o2::constants::math'; did you mean 'PI'?
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:196:75: error: could not convert '{629, 0, <expression error>, "Rad", "phi axis"}' from '<brace-enclosed initializer list>' to 'o2::framework::AxisSpec'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:210:45: error: 'pi' is not a member of 'o2::constants::math'; did you mean 'PI'?
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:210:74: error: 'pi' is not a member of 'o2::constants::math'; did you mean 'PI'?
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:210:99: error: 'pi' is not a member of 'o2::constants::math'; did you mean 'PI'?
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:210:137: error: 'pi' is not a member of 'o2::constants::math'; did you mean 'PI'?
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:210:159: error: could not convert '{{0, <expression error>, <expression error>, <expression error>, <expression error>}, "#phi", "phi bin"}' from '<brace-enclosed initializer list>' to 'o2::framework::AxisSpec'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:226:12: error: 'Particles' was not declared in this scope; did you mean 'TParticlePDG'?
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:226:21: error: template argument 1 is invalid
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:324:13: error: 'Particles' was not declared in this scope; did you mean 'TParticlePDG'?
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:324:22: error: template argument 1 is invalid
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:443:108: error: 'Particles' does not name a type; did you mean 'TParticlePDG'?
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:727:54: error: 'Particles' does not name a type; did you mean 'TParticlePDG'?
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:753:59: error: 'Particles' does not name a type; did you mean 'TParticlePDG'?
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:871:11: error: 'Particles' does not name a type; did you mean 'TParticlePDG'?
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:226:51: error: cannot convert 'const o2::framework::expressions::BindingNode' to 'int' in initialization
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:324:62: error: cannot convert 'o2::framework::expressions::Node' to 'int' in initialization
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:463:36: error: request for member 'sliceByCached' in 'mcParticles', which is of non-class type 'const int'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:666:58: error: 'Particles' was not declared in this scope; did you mean 'particle'?
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:666:68: error: no matching function for call to 'o2::soa::Table<o2::aod::Hash<519320931>, o2::aod::Hash<1837103245>, o2::aod::Hash<519320931>, o2::soa::JoinFull<o2::aod::Hash<1837103245>, o2::soa::JoinFull<o2::aod::Hash<3324719623>, o2::soa::Table<o2::aod::Hash<599863064>, o2::aod::Hash<2944948204>, o2::aod::Hash<2286545062> >, o2::soa::Table<o2::aod::Hash<3243953376>, o2::aod::Hash<3324719623>, o2::aod::Hash<1926198916> > >, o2::soa::Table<o2::aod::Hash<263224968>, o2::aod::Hash<1586729726>, o2::aod::Hash<2286545062> > >, o2::soa::JoinFull<o2::aod::Hash<1274903626>, o2::soa::Table<o2::aod::Hash<184273500>, o2::aod::Hash<1996537442>, o2::aod::Hash<2286545062> >, o2::soa::Table<o2::aod::Hash<518516411>, o2::aod::Hash<1274903626>, o2::aod::Hash<1926198916> > >, o2::soa::Table<o2::aod::Hash<2486124941>, o2::aod::Hash<2977027599>, o2::aod::Hash<2286545062> >, o2::soa::Table<o2::aod::Hash<3189221742>, o2::aod::Hash<2614466272>, o2::aod::Hash<2286545062> > >::TableIteratorBase<o2::soa::FilteredIndexPolicy, o2::soa::Filtered<o2::soa::JoinFull<o2::aod::Hash<1837103245>, o2::soa::JoinFull<o2::aod::Hash<1837103245>, o2::soa::JoinFull<o2::aod::Hash<3324719623>, o2::soa::Table<o2::aod::Hash<599863064>, o2::aod::Hash<2944948204>, o2::aod::Hash<2286545062> >, o2::soa::Table<o2::aod::Hash<3243953376>, o2::aod::Hash<3324719623>, o2::aod::Hash<1926198916> > >, o2::soa::Table<o2::aod::Hash<263224968>, o2::aod::Hash<1586729726>, o2::aod::Hash<2286545062> > >, o2::soa::JoinFull<o2::aod::Hash<1274903626>, o2::soa::Table<o2::aod::Hash<184273500>, o2::aod::Hash<1996537442>, o2::aod::Hash<2286545062> >, o2::soa::Table<o2::aod::Hash<518516411>, o2::aod::Hash<1274903626>, o2::aod::Hash<1926198916> > >, o2::soa::Table<o2::aod::Hash<2486124941>, o2::aod::Hash<2977027599>, o2::aod::Hash<2286545062> >, o2::soa::Table<o2::aod::Hash<3189221742>, o2::aod::Hash<2614466272>, o2::aod::Hash<2286545062> > > >, o2::soa::JoinFull<o2::aod::Hash<1837103245>, o2::soa::JoinFull<o2::aod::Hash<3324719623>, o2::soa::Table<o2::aod::Hash<599863064>, o2::aod::Hash<2944948204>, o2::aod::Hash<2286545062> >, o2::soa::Table<o2::aod::Hash<3243953376>, o2::aod::Hash<3324719623>, o2::aod::Hash<1926198916> > >, o2::soa::Table<o2::aod::Hash<263224968>, o2::aod::Hash<1586729726>, o2::aod::Hash<2286545062> > >, o2::soa::JoinFull<o2::aod::Hash<1274903626>, o2::soa::Table<o2::aod::Hash<184273500>, o2::aod::Hash<1996537442>, o2::aod::Hash<2286545062> >, o2::soa::Table<o2::aod::Hash<518516411>, o2::aod::Hash<1274903626>, o2::aod::Hash<1926198916> > >, o2::soa::Table<o2::aod::Hash<2486124941>, o2::aod::Hash<2977027599>, o2::aod::Hash<2286545062> >, o2::soa::Table<o2::aod::Hash<3189221742>, o2::aod::Hash<2614466272>, o2::aod::Hash<2286545062> > >::mcParticle_as<<expression error> >() const'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:666:68: error: template argument 1 is invalid
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:686:41: error: request for member 'rawIteratorAt' in 'mcParticles', which is of non-class type 'const int'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:739:38: error: request for member 'sliceBy' in 'particles', which is of non-class type 'const int'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:759:33: error: 'begin' was not declared in this scope
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:759:33: error: 'end' was not declared in this scope
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:775:33: error: 'begin' was not declared in this scope
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/GlobalEventProperties/dndetaHi.cxx:775:33: error: 'end' was not declared in this scope
/sw/slc9_x86-64/O2/daily-20260415-0000-local1/include/Framework/StructToTuple.h:141:38: error: static assertion failed: You need to make sure that you have implicit constructors or that you call the explicit constructor correctly.
/sw/slc9_x86-64/GCC-Toolchain/v14.2.0-alice2-1/include/c++/14.2.0/bits/stl_construct.h:115:28: error: no matching function for call to 'construct_at(DndetaHi*&)'
ninja: build stopped: subcommand failed.

Full log here.

@vkucera
Copy link
Copy Markdown
Collaborator

vkucera commented Apr 15, 2026

@hyungjun-lee You are supposed to test your changes before making a PR. Your code contains obvious errors which make the compilation fail. How did you test your changes?

@hyungjun-lee
Copy link
Copy Markdown
Contributor Author

@vkucera hello, Vit. It appears that parts affecting the build were inadvertently modified while updating the code to pass O2linter. The previous version of the code had been thoroughly tested in the local environment. I have now corrected the relevant sections and re-uploaded the code.

@vkucera
Copy link
Copy Markdown
Collaborator

vkucera commented Apr 16, 2026

I don't think your list of includes is correct. Please fix it. See https://aliceo2group.github.io/analysis-framework/docs/tools/#cleaning-include-statements-and-using-statements

Comment on lines +81 to +90
enum {
kECbegin = 0,
kDATA = 1,
kINEL,
kINELg0,
kDD,
kSD,
kND,
kECend
};
Copy link
Copy Markdown
Collaborator

@vkucera vkucera Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Give the enum a name.
  • Don't use the k prefix. It violates the naming conventions.
  • Assigning 1 is redundant. It is also done because of the 0.

Comment on lines +547 to +555
case 211:
pid = kPion;
break;
case 321:
pid = kKaon;
break;
case 2212:
pid = kProtonMy;
break;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the named PDG codes.

auto pTrack = v0.template posTrack_as<DaughterTracks>();
auto nTrack = v0.template negTrack_as<DaughterTracks>();

if (0 && v0.v0radius() > v0Radius &&
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the 0 doing there?

std::abs(pTrack.eta()) < etaDau &&
std::abs(nTrack.eta()) < etaDau) {

registry.fill(HIST("hv0mass"), cent, double(kK0short), v0.eta(), double(v0.mK0Short()));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need the casting?

- Convert all C-style anonymous enums to typed enum classes:
  EventCategory, TriggerClass, Species, TrackSign, AnalysisStep,
  ParticleType, PtVariation
- Add constexpr toInt<E>() helper to convert scoped enum to int
  for use with registry.fill() and vector indexing
- Rename ambiguous enumerators for clarity:
  kProtonMy -> Proton, kOPar -> Other, kNoPtVar -> None, kPtDw -> Down
- Update all usages throughout processData, processMC, and
  processMCNoV0Counting process functions
- Remove dead V0 loop code in processMCV0Counting (parameter
  fullV0s unused, inner loop had permanent `0 &&` guard)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment on lines +173 to +175
// Scoped-enum → int helper
template <typename E>
constexpr int toInt(E e) { return static_cast<int>(e); }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use unscoped enumerations with the prefixes, you don't need all this nonsense that Claude did.

namespace
{
template <typename T>
static constexpr bool hasCent()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused

Comment on lines +177 to +198
// Weights and Fill values magic numbers
constexpr float W1 = -10.0f;
constexpr float W2 = 2.0f;
constexpr float W3 = 5.0f;
constexpr float W4 = 0.5f;
constexpr float Fill1 = 1.0f;
constexpr float Fill2 = 2.0f;
constexpr float Fill3 = 3.0f;
constexpr float Fill4 = 4.0f;
constexpr float Fill5 = 5.0f;
constexpr float Fill6 = 6.0f;
constexpr float Fill7 = 7.0f;
constexpr float Fill9 = 9.0f;
constexpr float Fill10 = 10.0f;
constexpr float Fill11 = 11.0f;
constexpr float Fill12 = 12.0f;
constexpr float Fill13 = 13.0f;
constexpr float Fill14 = 14.0f;
constexpr float Fill15 = 15.0f;
constexpr float Fill16 = 16.0f;
constexpr float Fill17 = 17.0f;
constexpr float FillM1 = -1.0f;
Copy link
Copy Markdown
Collaborator

@vkucera vkucera Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These generic constants make no sense. Declare proper named enum constants and use them to label and fill the bins.

Comment on lines +312 to +320
x->SetBinLabel(1, "All");
x->SetBinLabel(2, "Sel8");
x->SetBinLabel(3, "Sel8z10");
x->SetBinLabel(4, "Generated INEL>0");
x->SetBinLabel(5, "Good BCs");
x->SetBinLabel(6, "BCs with collisions");
x->SetBinLabel(7, "BCs with pile-up/splitting");
x->SetBinLabel(8, "INEL&Sel8&mcz10");
x->SetBinLabel(9, "INEL");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super bug-prone to maintain. Use enum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

4 participants